package com.yc.test.threadPool;

import lombok.Data;

@Data
public class MyTask implements Runnable {

    private long taskNum;
    public MyTask(long num) {
        this.taskNum = num;
    }
    @Override
    public void run() {
        System.out.println("正在执行task " + taskNum);
        try {
            Thread.currentThread().sleep(11000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("task " + taskNum + "执行完毕");
        System.out.println("线程池中线程数目：" + MyExecutor.executor.getPoolSize() + "，队列中等待执行的任务数目：" +
                MyExecutor.executor.getQueue().size() + "，已执行玩别的任务数目：" + MyExecutor.executor.getCompletedTaskCount());
    }
}
